//
//  LGCiTangFamilyTreeHeader.m
//  ligenyun
//
//  Created by Mac on 2018/3/26.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGCiTangFamilyTreeHeader.h"
@interface LGCiTangFamilyTreeHeader()
@property(nonatomic, strong) UIImageView                     *bannerImageView;
@property(nonatomic, strong) STLabel                     *titleLable;
@property(nonatomic, strong) STLabel                     *shiZuLable;
@property(nonatomic, strong) STLabel                     *fangXiLable;
@property(nonatomic, strong) STLabel                     *juanHaoLable;
@property(nonatomic, strong) STLabel                     *updatTimeLable;
@property(nonatomic, strong) STLabel                     *addLable;
@end
@implementation LGCiTangFamilyTreeHeader

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    UIView * grawView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 10)];
    grawView.backgroundColor = TM_backgroundColor;
    [self addSubview:grawView];
    
    self.bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, grawView.bottom, 100, 120)];
    self.bannerImageView.image = [UIImage imageNamed:@"图03"];
    [self addSubview:self.bannerImageView];
    
    
    
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, self.bannerImageView.top + 10, 300, 30)
                                                     text:@"赵氏族谱"
                                                textColor:FirstTextColor
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    self.titleLable = titleLable;
    [self addSubview:titleLable];
    
    
    self.shiZuLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, titleLable.bottom, 300, 20)
                                                text:@"始祖:赵朝朝"
                                                textColor:SecendTextColor
                                                     font:13
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.shiZuLable];
    
    self.fangXiLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, self.shiZuLable.bottom, 300, 20)
                                                text:@"房系:赵朝"
                                           textColor:SecendTextColor
                                                font:13
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.fangXiLable];
    
    self.juanHaoLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, self.fangXiLable.bottom, 300, 20)
                                                 text:@"券号:1231231231"
                                            textColor:SecendTextColor
                                                 font:13
                                          isSizetoFit:NO
                                        textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.juanHaoLable];
    
    
    self.updatTimeLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, self.juanHaoLable.bottom, 300, 20)
                                                  text:@"修谱时间:2018年03月26日13:59:14"
                                             textColor:SecendTextColor
                                                  font:13
                                           isSizetoFit:NO
                                         textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.updatTimeLable];
    
    self.addLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 30, self.updatTimeLable.bottom, 300, 20)
                                                    text:@"地址:成都市高新区"
                                               textColor:SecendTextColor
                                                    font:13
                                             isSizetoFit:NO
                                           textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.addLable];
    
    STButton * bianjiButton = [self deflutButtonWithTitle:@"编辑谱书"];
    bianjiButton.left = self.bannerImageView.left;
    bianjiButton.top = self.bannerImageView.bottom + 40;
    [self addSubview:bianjiButton];
    
    STButton * zhuanjiButton = [self deflutButtonWithTitle:@"族谱传记"];
    zhuanjiButton.left = bianjiButton.right + 15;
    zhuanjiButton.top = self.bannerImageView.bottom + 40;
    [self addSubview:zhuanjiButton];
    
    STButton * lookButton = [self deflutButtonWithTitle:@"查看谱书"];
    lookButton.left = zhuanjiButton.right + 15;
    lookButton.top = self.bannerImageView.bottom + 40;
    [self addSubview:lookButton];
    
    STButton * citangButton = [self deflutButtonWithTitle:@"宗教祠堂"];
    citangButton.left = self.bannerImageView.left;
    citangButton.top = bianjiButton.bottom + 15;
    [self addSubview:citangButton];
    
    STButton * diliButton = [self deflutButtonWithTitle:@"地理位置"];
    diliButton.left = citangButton.right + 15;
    diliButton.top = bianjiButton.bottom + 15;
    [self addSubview:diliButton];
    
    self.height = diliButton.bottom + 20;
}
- (STButton*)deflutButtonWithTitle:(NSString*)title{
    __weak typeof(self) weakSelf =  self;
    STButton * buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 85, 30)
                                                     title:title
                                                titleColor:SecendTextColor
                                                 titleFont:14
                                              cornerRadius:4
                                           backgroundColor:TM_grayBackGroundColor
                                           backgroundImage:nil
                                                     image:nil];
    buyButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [buyButton setClicAction:^(UIButton *sender) {
        if (weakSelf.onSelctedMenuButton) {
            weakSelf.onSelctedMenuButton(title);
        }
    }];
    return buyButton;
}
#pragma mark --Action Method

@end
